//
//  BannerTableViewCell.m
//  NewProject
//
//  Created by apple on 2018/5/31.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "BannerTableViewCell.h"

@implementation BannerTableViewCell{
    NSInteger toItemIndex;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    toItemIndex = 0;
    self.bannerIcarousel.pagingEnabled = YES;
    
    self.bannerIcarousel.bounces = NO;
    self.bannerIcarousel.type = iCarouselTypeLinear;
}



- (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel{
    return 2;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(nullable UIView *)view{
    if (nil==view) {
        view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        ((UIImageView *)view).image = [UIImage imageNamed:[NSString stringWithFormat:@"banner%ld",index+1]];
    }
    return view;
}

- (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index{
    if (self.tapIndex) {
        self.tapIndex(index);
    }
}

- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value{
    if (option==iCarouselOptionWrap) {
        return YES;
    }
    return value;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
